import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        sellerCode: "",
        articleTypes:[],
    },
    mutations: {

        setSellerCode: function (state, payload) {
            state.sellerCode = payload;
        }
    },
    actions: {
        initArticleTypes:function(context){
            axios.get('http://localhost:8899/articleType')
                .then(res=>{
                    console.log(JSON.stringify(res.data));
                    context.state.articleTypes=res.data;
                });
        }


    }
})
